<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
<title>basic-demo</title>
<script>
var start=new Date();
</script>
<script src="./template.js"></script>
</head>
<body>
<div id="content"></div>
<script id="tpl" type="text/html">
    <ul>
        <%for(i = 0;i<list.length;i++){%>
            <li><%=list[i].name%> (index: <%=i%>)</li>
        <%}%>
        <%blah.forEach(function(it){%>
            <li>
                num: <%=it.num%> <br />
                <%if(it.num==3){%>
                    <%it.inner.forEach(function(it2){%>
                        <%=it2.time%> <br />
                    <%})%>
                <%}%>
            </li>
        <%})%>
    </ul>
</script>

<script>
var data = {
    list: [
        {name:' guokai', show: true},
        {name:' benben', show: false},
        {name:' dierbaby', show: true}
    ],
    blah: [
        {num: 1},
        {num: 2},
        {num: 3, inner:[
            {'time': '15:00'},
            {'time': '16:00'},
            {'time': '17:00'},
            {'time': '18:00'}
        ]},
        {num: 4}
    ]
};
var html = template('tpl', data);
document.getElementById('content').innerHTML = html;
for(i=0;i<100000;i++){
	template('tpl', data)
}
console.log(new Date()-start)
</script>

</body></html>